<?php
include_once('./lib/simple_html_dom.php');
$host_url ="http://www.epubit.com.cn";
$target_url ="http://www.epubit.com.cn/article?Tab=article&Sort=new&Mode=List&page=1";
$html= file_get_html($target_url);
$result = array();
$data=array();
foreach($html->find('h6[class=article-name]') as $e){
    $href=$e->children(0)->href;
    if(preg_match("/^\/article\/\d+/i",$href,$matches)){
        $text=$e->plaintext ;
        $url=  $host_url.$href;
        $item["title"] =trim($text);
        $item["url"]=$url;
        $data[]=$item;
    }

}
$result["error"]=0;
$result["data"]=$data;
header('Content-type: application/json');
echo json_encode($result);


